3.2 \(\int (f+\frac{g}{x})^2 (A+B \log (e (\frac{a+b x}{c+d x})^n)) \, dx\)

Optimal. Leaf size=263 \[ -2 B f g n \text{PolyLog}\left (2,-\frac{b x}{a}\right )+2 B f g n \text{PolyLog}\left (2,-\frac{d x}{c}\right )+2 f g \log (x) \left (B \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )+A\right )+\frac{g^2 (a+b x) (b c-a d) \left (B \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )+A\right )}{a (c+d x) \left (a-\frac{c (a+b x)}{c+d x}\right )}+\frac{B f^2 (a+b x) \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )}{b}-\frac{B f^2 n (b c-a d) \log (c+d x)}{b d}+\frac{B g^2 n (b c-a d) \log \left (a-\frac{c (a+b x)}{c+d x}\right )}{a c}-2 B f g n \log (x) \log \left (\frac{b x}{a}+1\right )+A f^2 x+2 B f g n \log (x) \log \left (\frac{d x}{c}+1\right ) \]

[Out]

A*f^2*x - 2*B*f*g*n*Log[x]*Log[1 + (b*x)/a] + (B*f^2*(a + b*x)*Log[e*((a + b*x)/(c + d*x))^n])/b + ((b*c - a*d
)*g^2*(a + b*x)*(A + B*Log[e*((a + b*x)/(c + d*x))^n]))/(a*(c + d*x)*(a - (c*(a + b*x))/(c + d*x))) + 2*f*g*Lo
g[x]*(A + B*Log[e*((a + b*x)/(c + d*x))^n]) - (B*(b*c - a*d)*f^2*n*Log[c + d*x])/(b*d) + 2*B*f*g*n*Log[x]*Log[
1 + (d*x)/c] + (B*(b*c - a*d)*g^2*n*Log[a - (c*(a + b*x))/(c + d*x)])/(a*c) - 2*B*f*g*n*PolyLog[2, -((b*x)/a)]
 + 2*B*f*g*n*PolyLog[2, -((d*x)/c)]

________________________________________________________________________________________

Rubi [A]  time = 0.337362, antiderivative size = 242, normalized size of antiderivative = 0.92, number of steps used = 16, number of rules used = 10, integrand size = 32, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.312, Rules used = {2528, 2486, 31, 2525, 12, 72, 2524, 2357, 2317, 2391} \[ -2 B f g n \text{PolyLog}\left (2,-\frac{b x}{a}\right )+2 B f g n \text{PolyLog}\left (2,-\frac{d x}{c}\right )+2 f g \log (x) \left (B \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )+A\right )-\frac{g^2 \left (B \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )+A\right )}{x}+\frac{B f^2 (a+b x) \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )}{b}-\frac{B f^2 n (b c-a d) \log (c+d x)}{b d}+\frac{B g^2 n \log (x) (b c-a d)}{a c}-2 B f g n \log (x) \log \left (\frac{b x}{a}+1\right )-\frac{b B g^2 n \log (a+b x)}{a}+A f^2 x+2 B f g n \log (x) \log \left (\frac{d x}{c}+1\right )+\frac{B d g^2 n \log (c+d x)}{c} \]

Antiderivative was successfully verified.

[In]

Int[(f + g/x)^2*(A + B*Log[e*((a + b*x)/(c + d*x))^n]),x]

[Out]

A*f^2*x + (B*(b*c - a*d)*g^2*n*Log[x])/(a*c) - (b*B*g^2*n*Log[a + b*x])/a - 2*B*f*g*n*Log[x]*Log[1 + (b*x)/a]
+ (B*f^2*(a + b*x)*Log[e*((a + b*x)/(c + d*x))^n])/b - (g^2*(A + B*Log[e*((a + b*x)/(c + d*x))^n]))/x + 2*f*g*
Log[x]*(A + B*Log[e*((a + b*x)/(c + d*x))^n]) - (B*(b*c - a*d)*f^2*n*Log[c + d*x])/(b*d) + (B*d*g^2*n*Log[c +
d*x])/c + 2*B*f*g*n*Log[x]*Log[1 + (d*x)/c] - 2*B*f*g*n*PolyLog[2, -((b*x)/a)] + 2*B*f*g*n*PolyLog[2, -((d*x)/
c)]

Rule 2528

Int[((a_.) + Log[(c_.)*(RFx_)^(p_.)]*(b_.))^(n_.)*(RGx_), x_Symbol] :> With[{u = ExpandIntegrand[(a + b*Log[c*
RFx^p])^n, RGx, x]}, Int[u, x] /; SumQ[u]] /; FreeQ[{a, b, c, p}, x] && RationalFunctionQ[RFx, x] && RationalF
unctionQ[RGx, x] && IGtQ[n, 0]

Rule 2486

Int[Log[(e_.)*((f_.)*((a_.) + (b_.)*(x_))^(p_.)*((c_.) + (d_.)*(x_))^(q_.))^(r_.)]^(s_.), x_Symbol] :> Simp[((
a + b*x)*Log[e*(f*(a + b*x)^p*(c + d*x)^q)^r]^s)/b, x] + Dist[(q*r*s*(b*c - a*d))/b, Int[Log[e*(f*(a + b*x)^p*
(c + d*x)^q)^r]^(s - 1)/(c + d*x), x], x] /; FreeQ[{a, b, c, d, e, f, p, q, r, s}, x] && NeQ[b*c - a*d, 0] &&
EqQ[p + q, 0] && IGtQ[s, 0]

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 2525

Int[((a_.) + Log[(c_.)*(RFx_)^(p_.)]*(b_.))^(n_.)*((d_.) + (e_.)*(x_))^(m_.), x_Symbol] :> Simp[((d + e*x)^(m
+ 1)*(a + b*Log[c*RFx^p])^n)/(e*(m + 1)), x] - Dist[(b*n*p)/(e*(m + 1)), Int[SimplifyIntegrand[((d + e*x)^(m +
 1)*(a + b*Log[c*RFx^p])^(n - 1)*D[RFx, x])/RFx, x], x], x] /; FreeQ[{a, b, c, d, e, m, p}, x] && RationalFunc
tionQ[RFx, x] && IGtQ[n, 0] && (EqQ[n, 1] || IntegerQ[m]) && NeQ[m, -1]

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 72

Int[((e_.) + (f_.)*(x_))^(p_.)/(((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))), x_Symbol] :> Int[ExpandIntegrand[(
e + f*x)^p/((a + b*x)*(c + d*x)), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && IntegerQ[p]

Rule 2524

Int[((a_.) + Log[(c_.)*(RFx_)^(p_.)]*(b_.))^(n_.)/((d_.) + (e_.)*(x_)), x_Symbol] :> Simp[(Log[d + e*x]*(a + b
*Log[c*RFx^p])^n)/e, x] - Dist[(b*n*p)/e, Int[(Log[d + e*x]*(a + b*Log[c*RFx^p])^(n - 1)*D[RFx, x])/RFx, x], x
] /; FreeQ[{a, b, c, d, e, p}, x] && RationalFunctionQ[RFx, x] && IGtQ[n, 0]

Rule 2357

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*(RFx_), x_Symbol] :> With[{u = ExpandIntegrand[(a + b*Log[c*x^
n])^p, RFx, x]}, Int[u, x] /; SumQ[u]] /; FreeQ[{a, b, c, n}, x] && RationalFunctionQ[RFx, x] && IGtQ[p, 0]

Rule 2317

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)/((d_) + (e_.)*(x_)), x_Symbol] :> Simp[(Log[1 + (e*x)/d]*(a +
b*Log[c*x^n])^p)/e, x] - Dist[(b*n*p)/e, Int[(Log[1 + (e*x)/d]*(a + b*Log[c*x^n])^(p - 1))/x, x], x] /; FreeQ[
{a, b, c, d, e, n}, x] && IGtQ[p, 0]

Rule 2391

Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> -Simp[PolyLog[2, -(c*e*x^n)]/n, x] /; FreeQ[{c, d,
 e, n}, x] && EqQ[c*d, 1]

Rubi steps

\begin{align*} \int \left (f+\frac{g}{x}\right )^2 \left (A+B \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )\right ) \, dx &=\int \left (f^2 \left (A+B \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )\right )+\frac{g^2 \left (A+B \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )\right )}{x^2}+\frac{2 f g \left (A+B \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )\right )}{x}\right ) \, dx\\ &=f^2 \int \left (A+B \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )\right ) \, dx+(2 f g) \int \frac{A+B \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )}{x} \, dx+g^2 \int \frac{A+B \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )}{x^2} \, dx\\ &=A f^2 x-\frac{g^2 \left (A+B \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )\right )}{x}+2 f g \log (x) \left (A+B \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )\right )+\left (B f^2\right ) \int \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right ) \, dx-(2 B f g n) \int \frac{(c+d x) \left (-\frac{d (a+b x)}{(c+d x)^2}+\frac{b}{c+d x}\right ) \log (x)}{a+b x} \, dx+\left (B g^2 n\right ) \int \frac{b c-a d}{x (a+b x) (c+d x)} \, dx\\ &=A f^2 x+\frac{B f^2 (a+b x) \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )}{b}-\frac{g^2 \left (A+B \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )\right )}{x}+2 f g \log (x) \left (A+B \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )\right )-\frac{\left (B (b c-a d) f^2 n\right ) \int \frac{1}{c+d x} \, dx}{b}-(2 B f g n) \int \left (\frac{b \log (x)}{a+b x}-\frac{d \log (x)}{c+d x}\right ) \, dx+\left (B (b c-a d) g^2 n\right ) \int \frac{1}{x (a+b x) (c+d x)} \, dx\\ &=A f^2 x+\frac{B f^2 (a+b x) \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )}{b}-\frac{g^2 \left (A+B \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )\right )}{x}+2 f g \log (x) \left (A+B \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )\right )-\frac{B (b c-a d) f^2 n \log (c+d x)}{b d}-(2 b B f g n) \int \frac{\log (x)}{a+b x} \, dx+(2 B d f g n) \int \frac{\log (x)}{c+d x} \, dx+\left (B (b c-a d) g^2 n\right ) \int \left (\frac{1}{a c x}+\frac{b^2}{a (-b c+a d) (a+b x)}+\frac{d^2}{c (b c-a d) (c+d x)}\right ) \, dx\\ &=A f^2 x+\frac{B (b c-a d) g^2 n \log (x)}{a c}-\frac{b B g^2 n \log (a+b x)}{a}-2 B f g n \log (x) \log \left (1+\frac{b x}{a}\right )+\frac{B f^2 (a+b x) \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )}{b}-\frac{g^2 \left (A+B \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )\right )}{x}+2 f g \log (x) \left (A+B \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )\right )-\frac{B (b c-a d) f^2 n \log (c+d x)}{b d}+\frac{B d g^2 n \log (c+d x)}{c}+2 B f g n \log (x) \log \left (1+\frac{d x}{c}\right )+(2 B f g n) \int \frac{\log \left (1+\frac{b x}{a}\right )}{x} \, dx-(2 B f g n) \int \frac{\log \left (1+\frac{d x}{c}\right )}{x} \, dx\\ &=A f^2 x+\frac{B (b c-a d) g^2 n \log (x)}{a c}-\frac{b B g^2 n \log (a+b x)}{a}-2 B f g n \log (x) \log \left (1+\frac{b x}{a}\right )+\frac{B f^2 (a+b x) \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )}{b}-\frac{g^2 \left (A+B \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )\right )}{x}+2 f g \log (x) \left (A+B \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )\right )-\frac{B (b c-a d) f^2 n \log (c+d x)}{b d}+\frac{B d g^2 n \log (c+d x)}{c}+2 B f g n \log (x) \log \left (1+\frac{d x}{c}\right )-2 B f g n \text{Li}_2\left (-\frac{b x}{a}\right )+2 B f g n \text{Li}_2\left (-\frac{d x}{c}\right )\\ \end{align*}

Mathematica [A]  time = 0.230476, size = 217, normalized size = 0.83 \[ -2 B f g n \left (\text{PolyLog}\left (2,-\frac{b x}{a}\right )-\text{PolyLog}\left (2,-\frac{d x}{c}\right )+\log (x) \left (\log \left (\frac{b x}{a}+1\right )-\log \left (\frac{d x}{c}+1\right )\right )\right )+2 f g \log (x) \left (B \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )+A\right )-\frac{g^2 \left (B \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )+A\right )}{x}+\frac{B f^2 (a+b x) \log \left (e \left (\frac{a+b x}{c+d x}\right )^n\right )}{b}-\frac{B f^2 n (b c-a d) \log (c+d x)}{b d}+\frac{B g^2 n (\log (x) (b c-a d)-b c \log (a+b x)+a d \log (c+d x))}{a c}+A f^2 x \]

Antiderivative was successfully verified.

[In]

Integrate[(f + g/x)^2*(A + B*Log[e*((a + b*x)/(c + d*x))^n]),x]

[Out]

A*f^2*x + (B*f^2*(a + b*x)*Log[e*((a + b*x)/(c + d*x))^n])/b - (g^2*(A + B*Log[e*((a + b*x)/(c + d*x))^n]))/x
+ 2*f*g*Log[x]*(A + B*Log[e*((a + b*x)/(c + d*x))^n]) - (B*(b*c - a*d)*f^2*n*Log[c + d*x])/(b*d) + (B*g^2*n*((
b*c - a*d)*Log[x] - b*c*Log[a + b*x] + a*d*Log[c + d*x]))/(a*c) - 2*B*f*g*n*(Log[x]*(Log[1 + (b*x)/a] - Log[1
+ (d*x)/c]) + PolyLog[2, -((b*x)/a)] - PolyLog[2, -((d*x)/c)])

________________________________________________________________________________________

Maple [F]  time = 0.086, size = 0, normalized size = 0. \begin{align*} \int \left ( f+{\frac{g}{x}} \right ) ^{2} \left ( A+B\ln \left ( e \left ({\frac{bx+a}{dx+c}} \right ) ^{n} \right ) \right ) \, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((f+g/x)^2*(A+B*ln(e*((b*x+a)/(d*x+c))^n)),x)

[Out]

int((f+g/x)^2*(A+B*ln(e*((b*x+a)/(d*x+c))^n)),x)

________________________________________________________________________________________

Maxima [F]  time = 0., size = 0, normalized size = 0. \begin{align*} B f^{2} n{\left (\frac{a \log \left (b x + a\right )}{b} - \frac{c \log \left (d x + c\right )}{d}\right )} - B g^{2} n{\left (\frac{b \log \left (b x + a\right )}{a} - \frac{d \log \left (d x + c\right )}{c} - \frac{{\left (b c - a d\right )} \log \left (x\right )}{a c}\right )} + B f^{2} x \log \left (e{\left (\frac{b x}{d x + c} + \frac{a}{d x + c}\right )}^{n}\right ) + A f^{2} x - 2 \, B f g \int -\frac{\log \left ({\left (b x + a\right )}^{n}\right ) - \log \left ({\left (d x + c\right )}^{n}\right ) + \log \left (e\right )}{x}\,{d x} + 2 \, A f g \log \left (x\right ) - \frac{B g^{2} \log \left (e{\left (\frac{b x}{d x + c} + \frac{a}{d x + c}\right )}^{n}\right )}{x} - \frac{A g^{2}}{x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((f+g/x)^2*(A+B*log(e*((b*x+a)/(d*x+c))^n)),x, algorithm="maxima")

[Out]

B*f^2*n*(a*log(b*x + a)/b - c*log(d*x + c)/d) - B*g^2*n*(b*log(b*x + a)/a - d*log(d*x + c)/c - (b*c - a*d)*log
(x)/(a*c)) + B*f^2*x*log(e*(b*x/(d*x + c) + a/(d*x + c))^n) + A*f^2*x - 2*B*f*g*integrate(-(log((b*x + a)^n) -
 log((d*x + c)^n) + log(e))/x, x) + 2*A*f*g*log(x) - B*g^2*log(e*(b*x/(d*x + c) + a/(d*x + c))^n)/x - A*g^2/x

________________________________________________________________________________________

Fricas [F]  time = 0., size = 0, normalized size = 0. \begin{align*}{\rm integral}\left (\frac{A f^{2} x^{2} + 2 \, A f g x + A g^{2} +{\left (B f^{2} x^{2} + 2 \, B f g x + B g^{2}\right )} \log \left (e \left (\frac{b x + a}{d x + c}\right )^{n}\right )}{x^{2}}, x\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((f+g/x)^2*(A+B*log(e*((b*x+a)/(d*x+c))^n)),x, algorithm="fricas")

[Out]

integral((A*f^2*x^2 + 2*A*f*g*x + A*g^2 + (B*f^2*x^2 + 2*B*f*g*x + B*g^2)*log(e*((b*x + a)/(d*x + c))^n))/x^2,
 x)

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((f+g/x)**2*(A+B*ln(e*((b*x+a)/(d*x+c))**n)),x)

[Out]

Timed out

________________________________________________________________________________________

Giac [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int{\left (B \log \left (e \left (\frac{b x + a}{d x + c}\right )^{n}\right ) + A\right )}{\left (f + \frac{g}{x}\right )}^{2}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((f+g/x)^2*(A+B*log(e*((b*x+a)/(d*x+c))^n)),x, algorithm="giac")

[Out]

integrate((B*log(e*((b*x + a)/(d*x + c))^n) + A)*(f + g/x)^2, x)